package com.example.newproject_overseas.components

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.platform.LocalContext
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.example.newproject_overseas.Screen.AskQuestions
import com.example.newproject_overseas.Screen.AskQuestionsChat
import com.example.newproject_overseas.Screen.Bank
import com.example.newproject_overseas.Screen.ClauseAgreement
import com.example.newproject_overseas.Screen.FristScreen
import com.example.newproject_overseas.Screen.GoldMoney
import com.example.newproject_overseas.Screen.GoldMoney_5
import com.example.newproject_overseas.Screen.HelpAndFeedback
import com.example.newproject_overseas.Screen.Level.OneLevel
import com.example.newproject_overseas.Screen.Level.TwoLevel
import com.example.newproject_overseas.Screen.Login
import com.example.newproject_overseas.Screen.MainFrame
import com.example.newproject_overseas.Screen.OcrCardScreen
import com.example.newproject_overseas.Screen.PermissionProtocol
import com.example.newproject_overseas.Screen.PrivacyAgreement
import com.example.newproject_overseas.Screen.ProductList
import com.example.newproject_overseas.Screen.ProductList_7
import com.example.newproject_overseas.Screen.RepaymentMode
import com.example.newproject_overseas.Screen.Rollover
import com.example.newproject_overseas.Screen.WorkInfomationScreen
import com.example.newproject_overseas.Screen.testCmpScreen
import com.example.newproject_overseas.ViewModel.LoginViewModel
import com.example.newproject_overseas.compositionLocal.LocalUserViewModel
import com.example.newproject_overseas.model.entity.ChatViewModel
import com.google.accompanist.insets.ProvideWindowInsets


@Composable
fun AppNav() {
    // 存储navigation状态
    //引入资源后这句话才不会报错
    val navController = rememberNavController()


    ProvideWindowInsets() {
        CompositionLocalProvider(LocalUserViewModel provides LoginViewModel(LocalContext.current)) {


            val context = LocalContext.current // 获取当前上下文
            val loginViewModel = LocalUserViewModel.current
            val viewModel = ChatViewModel()
            
            NavHost(navController = navController, startDestination = "FristScreen") {

                composable("FristScreen"){
                    FristScreen(navController)
                }
                composable("login") {
                    Login(navController)
                }
                composable("MainFrame") {
                    MainFrame(navController)
                }
                composable("OcrCardScreen", enterTransition = {
                    slideIntoContainer(
                        AnimatedContentTransitionScope.SlideDirection.Left
                    )
                }, exitTransition = {
                    slideOutOfContainer(
                        AnimatedContentTransitionScope.SlideDirection.Right
                    )
                }) {
                    OcrCardScreen(navController)
                }
                composable("Rollover"){
                    Rollover(navController)
                }
                composable("RepaymentMode") {
                    RepaymentMode(navController)
                }
                composable("GoldMoney") {
                    GoldMoney(navController)
                }
                composable("GoldMoney_5") {
                    GoldMoney_5(navController)
                }
                composable("HelpAndFeedback") {
                    HelpAndFeedback(navController)
                }
                composable("AskQuestions") {
                    AskQuestions(navController)
                }
                composable("AskQuestionsChat") {
                    AskQuestionsChat(navController,viewModel)
                }
                //顶部导航栏
                composable("TopApp") {
                    TopApp(title = "",navController)
                }
                composable("ProductList") {
                    ProductList(navController)
                }
                composable("ProductList_7") {
                    ProductList_7(navController)
                }
                //权限协议
                composable("PermissionProtocol") {
                    PermissionProtocol(navController)
                }
                //条款协议
                composable("ClauseAgreement") {
                    ClauseAgreement(navController)
                }

                //隐私协议
                composable("PrivacyAgreement") {
                    PrivacyAgreement(navController)
                }

                composable("testCmpScreen"){
                    testCmpScreen(navController)
                }
                composable("Bank"){
                    Bank(navController)
                }

                composable("WorkInfomationScreen"){
                    WorkInfomationScreen(navController)
                }
                composable("OneLevel"){
                    OneLevel(navController)
                }
                composable("TwoLevel/{occ1Id}"){it->
                    var occ1Id = it.arguments?.getString("occ1Id")
                    TwoLevel(navController,occ1Id)
                }
            }
        }
    }


}

